
package org.example.xxljob;

import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * xxl-job config
 *
 * @author xuxueli 2017-04-28
 */
@Configuration
public class XxlJobConfig {

    private String adminAddresses="http://127.0.0.1:9299/xxl-job-admin";

    private String appname="pull-order";

    private String ip="localhost";

    private int port=9999;

    private String logPath="d:\\logs\\XXLJOB-CLIENT";

    private int logRetentionDays=30;


    @Bean
    public XxlJobSpringExecutor xxlJobExecutor() {
        System.out.println("开始创建XxlJobSpringExecutor");
        XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
        xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
        xxlJobSpringExecutor.setAppname(appname);
        xxlJobSpringExecutor.setIp(ip);
        xxlJobSpringExecutor.setPort(port);
        xxlJobSpringExecutor.setLogPath(logPath);
        xxlJobSpringExecutor.setLogRetentionDays(logRetentionDays);
        System.out.println("创建XxlJobSpringExecutor成功");
        return xxlJobSpringExecutor;
    }
}